<template>
  <div class='souce-main'>
    <h2>数据源状态</h2>
    <div class='content-menu'>
      <el-form ref="searchData" :model="searchData" label-width="90px" size="small">
        <el-form-item label="名称数据源:" style='width:40%' prop='name'>
          <el-input v-model="searchData.name" placeholder='请输入名称'></el-input>
        </el-form-item>
        <el-form-item label="油田:" prop='num'>
          <el-select v-model="searchData.num">
            <el-option label="全部" value=""></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="统建项目:" prop='num'>
          <el-select v-model="searchData.num">
            <el-option label="全部" value=""></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="服务器状态:" style='width:40%' prop='num'>
          <el-select v-model="searchData.num">
            <el-option label="全部" value=""></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="网络状态:" prop='num'>
          <el-select v-model="searchData.num">
            <el-option label="全部" value=""></el-option>
          </el-select>
        </el-form-item>
        <el-form-item style='text-align: right'>
          <el-button type="primary" @click='chack' size='mini'>查询</el-button>
          <el-button @click="resetForm('searchData')" size='mini'>重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class='content-main'>
      <div class='pageMenu'>
        <el-radio-group v-model="page" size='medium'>
          <el-radio-button label="1">列表</el-radio-button>
          <el-radio-button label="2">拓扑图</el-radio-button>
        </el-radio-group>
      </div>
      <div class='pageCont'>
        <table-list v-if='page==1' :chacked='chacked'></table-list>
        <topology v-else></topology>
      </div>
    </div>
  </div>
</template>

<script>
  import TableList from './components/TableList'
  import Topology from './components/Topology'
  export default {
    name: 'dataSouce',
    components: {
      TableList,
      Topology
    },
    data() {
      return {
        searchData: {
          name: '',
          num: ''
        },
        chacked: {},
        page: '1'
      }
    },
    created() {
      this.chacked = JSON.parse(JSON.stringify(this.searchData))
    },
    methods: {
      resetForm(formName) {
        this.$refs[formName].resetFields()
      },
      chack() {
        this.chacked = JSON.parse(JSON.stringify(this.searchData))
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss">
  .souce-main {
    padding: 0 20px 20px 20px;
    color: #666;
    h2 {
      height: 56px;
      line-height: 56px;
      color: #333;
      font-weight: normal;
      font-size: 18px;
    }
    .content-menu {
      background: #fff;
      padding: 20px;
      height: 116px;
      .el-form {
        .el-form-item {
          width: 30%;
          float: left;
          .el-select {
            width: 100%;
          }
        }
      }
    }
    .content-main {
      background: #fff;
      margin-top: 20px;
      padding: 20px;
      .pageMenu {
        text-align: right;
        .el-radio-button__inner {
          width: 74px;
          text-align: center;
          &:hover {
            color: #1989fa;
          }
        }
        .el-radio-button__orig-radio:checked+.el-radio-button__inner {
          background-color: #e6f1fc;
          color: #1989fa;
          border-color: #a3d0fd;
          -webkit-box-shadow: -1px 0 0 0 #a3d0fd;
          box-shadow: -1px 0 0 0 #a3d0fd;
        }
      }
      .pageCont {
        padding-top: 20px;
      }
    }
  }
</style>